import { get, post, ResPromise } from '@/utils/request';
/* type filterOptionType<T> = {
    value:string,
    disabled?:boolean;
    label: keyof T
}

export const getDataApi = (params:{
    projectId:string,
}):ResPromise<string[]>=>{
    return post('dd/aa/ff',params)
}

export const getFilterOptionApi = <T>(params:{
    type:string,
}):ResPromise<filterOptionType<T>[]>=>{
    return post("/aa/aa/ss",params)
} */

interface Userlogin {
  type: 0 | 1;
  accountName?: string;
  password?: string;
  mobile?: string;
  code?: string;
}

export interface IUserInfo {
  accountName: string;
  avatar: null;
  userName: string;
  _id: string;
  identity: number;
  department: string;
}

export interface IRouterType {
  icon: string;
  route: string;
  zhName: string;
  _id: string;
  children?: IRouterType[];
}

// 登入获取用户信息
export const userLoginApi = (params: Userlogin): ResPromise<IUserInfo> => {
  return post('/login', params);
};

// 获取手机验证码
export const getSmCodeApi = (params: { mobile: string }): ResPromise<string> => {
  return get('/getCode', params);
};

// 检测验证码输入的是否正确
export const checkCodeApi = (params: { smCode: string }): ResPromise<boolean> => {
  return get('/checkSmCode', params);
};

// 重置密码
export const resetPwdApi = (params: { newPassword: string }): ResPromise<boolean> => {
  return post('/resetPassword', params);
};

// 检测用户是否登录
export const queryUserLoginApi = (): ResPromise<string> => {
  return get('/queryLoginStatus');
};

// 获取路由表
export const getRouteListApi = (): ResPromise<IRouterType[]> => {
  return get('/getRouteList');
};

// 员工分析
export const analyzeStaffApi = (): ResPromise<any> => {
  return get('/analyzeStaff');
};
